<template>
  <div>
    <transition name="slide-up">
      <div v-show="menuVisible && settingVisible === 2" class="setting-wrapper">
        <div class="setting-progress">
          <div class="read-time-wrapper">
            <span class="read-time-text" />
            <span class="icon-forward" @click="prevSection" />
          </div>
          <div class="progress-wrapper">
            <div class="progress-icon-wrapper">
              <span class="icon-back" />
            </div>
            <input
              ref="progress"
              class="progress"
              type="range"
              max="100"
              min="0"
              step="1"
              :value="progress"
              :disabled="!bookAvailable"
              @change="onProgressChange($event.target.value)"
              @input="onProgressInput($event.target.value)"
            >
            <div class="progress-icon-wrapper">
              <span class="icon-forward" @click="nextSection" />
            </div>
          </div>
          <div class="text-wrapper">
            <span class="progress-section-text">
              {{ bookAvailable ? progress + '%' : '加载中...' }}
            </span>
          </div>
        </div>
      </div>
    </transition></div>
</template>

<script>
import { ebookMixin } from '../../mixin/mixin'
export default {
  mixins: [ebookMixin],
  data() {
    return {

    }
  },
  methods: {
    prevSection() {

    },
    nextSection() {

    },
    onProgressInput(val) {
      console.log('1=>', val)
    },
    onProgressChange(val) {
      console.log('2=>', val)
    }
  }
}
</script>

<style lang="scss" scoped>
@import '../../style/index';
.setting-wrapper {
    position: absolute;
    bottom: px2rem(48);
    left: 0;
    z-index: 190;
    width: 100%;
    height: px2rem(90);
    box-shadow: 0 px2rem(-8) px2rem(8) rgba(0, 0, 0, .15);
    .setting-progress {
      position: relative;
      width: 100%;
      height: 100%;
      .read-time-wrapper {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        height: px2rem(40);
        @include center;
        font-size: px2rem(12);
      }
      .progress-wrapper {
        width: 100%;
        height: 100%;
        @include center;
        padding: 0 px2rem(15);
        box-sizing: border-box;
        .progress {
          flex: 1;
          width: 100%;
          -webkit-appearance: none;
          height: px2rem(2);
          background: -webkit-linear-gradient(#5d6268, #5d6268) no-repeat, #b4b5b7;
          background-size: 0 100%;
          margin: 0 px2rem(10);
          &:focus {
            outline: none;
          }
          &::-webkit-slider-thumb {
            -webkit-appearance: none;
            height: px2rem(20);
            width: px2rem(20);
            border-radius: 50%;
            background: #ceced0;
            box-shadow: 0 px2rem(4) px2rem(6) 0 rgba(0, 0, 0, .15);
            border: none;
          }
        }
        .progress-icon-wrapper {
          flex: 0 0 px2rem(22);
          font-size: px2rem(22);
          @include center;
        }
      }
      .text-wrapper {
        position: absolute;
        left: 0;
        bottom: px2rem(5);
        width: 100%;
        font-size: px2rem(12);
        text-align: center;
        padding: 0 px2rem(15);
        box-sizing: border-box;
        @include center;
        .progress-section-text {
          line-height: px2rem(15);
        }
      }
    }
  }
</style>
